home *** CD-ROM | disk | FTP | other *** search
/ Gold Medal Software 5 / Gold Medal Software - Volume 5 (Gold Medal) (1995).iso / windows / win31 / cenviw.arj / WINEXECS.CMM < prev    next >
Text File  |  1994-03-08  |  1KB  |  29 lines

  1. /*************************************************************
  2.  *** WinExecs - Sample Cmm code to demonstrate uses of the ***
  3.  *** ver.1      WinExec() function.                        ***
  4.  *************************************************************/
  5.  
  6. #include <WinExec.lib>
  7. #include <MsgBox.lib>
  8.  
  9. MessageBox("The following samples show various ways\n"
  10.            "to use the Windows WinExec() function.\n"
  11.            "A wrapper for WinExec() is located in\n"
  12.            "the Cmm library: \"WinExec.lib\"",
  13.            "WinExecs - Welcome!");
  14.  
  15. MessageBox("Will now start up NotePad with the C:\\Autoexec.bat file","");
  16. result = WinExec("NotePad.exe c:\\AutoExec.bat");
  17. if ( result < 32 ) WinExecError(result);
  18.  
  19. MessageBox("Now start the File Manager minimized","");
  20. result = WinExec("WinFile.exe",SW_SHOWMINIMIZED);
  21. if ( result < 32 ) WinExecError(result);
  22.  
  23. WinExecError(ErrorNumber)
  24. {
  25.    sprintf(ErrorMessage,"That call to WinExec returned error: %d",ErrorNumber);
  26.    MessageBox(ErrorMessage);
  27. }
  28.  
  29.